<template>
  <b-container fluid>
    <b-row class="my-1" v-for="(val, index) in value" :key="index">
      <b-col>
        <b-form-input id="input-small" size="sm" type="text" v-model="val.input" :placeholder="val.tip"></b-form-input>
      </b-col>
    </b-row>
    <b-row class="my-1">
      <b-col sm="6"><b-button size="sm" variant="danger" @click="submit">提交</b-button></b-col>
      <b-col sm="6"><b-button size="sm" variant="primary" @click="cancel">取消</b-button></b-col>
    </b-row>
  </b-container>
</template>
<script>
  export default {
    name: 'Prompt',
    props:{
      value: Array
    },
    data() {
      return {
        msg: 'Welcome to Footer'
      }
    },
    mounted(){
      // console.log(this.$parent)
    },
    methods: {
      submit(){
        var fun = this.$parent.promptSubmit;
        if(fun) {
          fun(this.value);
        }
        this.$layer.closeAll();
      },
      cancel(){
        var fun = this.$parent.promptCancel;
        if(fun) {
          fun(this.value);
        }
        this.$layer.closeAll();
      }
    },
    components: {
    }
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  .col-sm-6 {
    text-align: center;
  }

</style>
